20. Exercise: Invalid Inserts in

Create an SQLite database for Sunshine

In this exercise you are required to prevent invalid inserts into the Weather DB!

To do so, change each column's type declaration to append NOT NULL, this will guarantee that every column in the database has a value, and hence won't accept an insert statement that does not contain data for all the columns in the table!

Make sure you increment the database version number from 1 to 2 since we have now changed the database schema.

Exercise Code

Exercise: S07.02-Exercise-PreventInvalidInserts

Check the boxes below once you're done:

SOLUTION:
  • Append NOT NULL to each column's type declaration
  • Update the DATABASE_VERSION value to 2